pacman_tests = [
  'tests/backup001.py',
  'tests/cache-server-basic.py',
  'tests/clean001.py',
  'tests/clean002.py',
  'tests/clean003.py',
  'tests/clean004.py',
  'tests/clean005.py',
  'tests/config001.py',
  'tests/config002.py',
  'tests/database001.py',
  'tests/database002.py',
  'tests/database010.py',
  'tests/database011.py',
  'tests/database012.py',
  'tests/dbonly-extracted-files.py',
  'tests/depconflict100.py',
  'tests/depconflict110.py',
  'tests/depconflict111.py',
  'tests/depconflict120.py',
  'tests/dependency-cycle-fixed-by-upgrade.py',
  'tests/deprange001.py',
  'tests/deptest001.py',
  'tests/dummy001.py',
  'tests/epoch001.py',
  'tests/epoch002.py',
  'tests/epoch003.py',
  'tests/epoch004.py',
  'tests/epoch005.py',
  'tests/epoch010.py',
  'tests/epoch011.py',
  'tests/epoch012.py',
  'tests/file-conflict-with-installed-pkg.py',
  'tests/fileconflict001.py',
  'tests/fileconflict002.py',
  'tests/fileconflict003.py',
  'tests/fileconflict004.py',
  'tests/fileconflict005.py',
  'tests/fileconflict006.py',
  'tests/fileconflict007.py',
  'tests/fileconflict008.py',
  'tests/fileconflict009.py',
  'tests/fileconflict010.py',
  'tests/fileconflict011.py',
  'tests/fileconflict012.py',
  'tests/fileconflict013.py',
  'tests/fileconflict015.py',
  'tests/fileconflict016.py',
  'tests/fileconflict017.py',
  'tests/fileconflict020.py',
  'tests/fileconflict021.py',
  'tests/fileconflict022.py',
  'tests/fileconflict023.py',
  'tests/fileconflict024.py',
  'tests/fileconflict025.py',
  'tests/fileconflict030.py',
  'tests/fileconflict031.py',
  'tests/fileconflict032.py',
  'tests/hook-abortonfail.py',
  'tests/hook-description-reused.py',
  'tests/hook-exec-reused.py',
  'tests/hook-exec-with-arguments.py',
  'tests/hook-file-change-packages.py',
  'tests/hook-file-remove-trigger-match.py',
  'tests/hook-file-upgrade-nomatch.py',
  'tests/hook-invalid-trigger.py',
  'tests/hook-pkg-install-trigger-match.py',
  'tests/hook-pkg-postinstall-trigger-match.py',
  'tests/hook-pkg-remove-trigger-match.py',
  'tests/hook-pkg-upgrade-trigger-match.py',
  'tests/hook-target-list.py',
  'tests/hook-type-reused.py',
  'tests/hook-upgrade-trigger-no-match.py',
  'tests/hook-when-reused.py',
  'tests/ignore001.py',
  'tests/ignore002.py',
  'tests/ignore003.py',
  'tests/ignore004.py',
  'tests/ignore005.py',
  'tests/ignore006.py',
  'tests/ignore007.py',
  'tests/ignore008.py',
  'tests/ldconfig001.py',
  'tests/ldconfig002.py',
  'tests/ldconfig003.py',
  'tests/mode001.py',
  'tests/mode002.py',
  'tests/mode003.py',
  'tests/multiple-architectures01.py',
  'tests/multiple-architectures02.py',
  'tests/noupgrade-inverted.py',
  'tests/overwrite-files-match-negated.py',
  'tests/overwrite-files-match.py',
  'tests/overwrite-files-nonmatch.py',
  'tests/pacman001.py',
  'tests/pacman002.py',
  'tests/pacman003.py',
  'tests/pacman004.py',
  'tests/pacman005.py',
  'tests/pkg-meta-invalid-name-file.py',
  'tests/pkg-meta-invalid-name-local.py',
  'tests/pkg-meta-invalid-name-sync.py',
  'tests/provision001.py',
  'tests/provision002.py',
  'tests/provision003.py',
  'tests/provision004.py',
  'tests/provision010.py',
  'tests/provision011.py',
  'tests/provision012.py',
  'tests/provision020.py',
  'tests/provision021.py',
  'tests/provision022.py',
  'tests/query001.py',
  'tests/query002.py',
  'tests/query003.py',
  'tests/query004.py',
  'tests/query005.py',
  'tests/query006.py',
  'tests/query007.py',
  'tests/query010.py',
  'tests/query011.py',
  'tests/query012.py',
  'tests/querycheck001.py',
  'tests/querycheck002.py',
  'tests/querycheck_fast_file_type.py',
  'tests/reason001.py',
  'tests/remove-assumeinstalled.py',
  'tests/remove-directory-replaced-with-symlink.py',
  'tests/remove-optdepend-of-installed-package.py',
  'tests/remove-recursive-cycle.py',
  'tests/remove001.py',
  'tests/remove002.py',
  'tests/remove010.py',
  'tests/remove011.py',
  'tests/remove012.py',
  'tests/remove020.py',
  'tests/remove021.py',
  'tests/remove030.py',
  'tests/remove031.py',
  'tests/remove040.py',
  'tests/remove041.py',
  'tests/remove042.py',
  'tests/remove043.py',
  'tests/remove044.py',
  'tests/remove045.py',
  'tests/remove047.py',
  'tests/remove049.py',
  'tests/remove050.py',
  'tests/remove051.py',
  'tests/remove052.py',
  'tests/remove060.py',
  'tests/remove070.py',
  'tests/remove071.py',
  'tests/replace-and-upgrade-package.py',
  'tests/replace100.py',
  'tests/replace101.py',
  'tests/replace102.py',
  'tests/replace103.py',
  'tests/replace104.py',
  'tests/replace110.py',
  'tests/sandbox-download-upgrade.py',
  'tests/sandbox-download-basic.py',
  'tests/scriptlet001.py',
  'tests/scriptlet002.py',
  'tests/scriptlet-signal-handling.py',
  'tests/scriptlet-signal-reset.py',
  'tests/sign001.py',
  'tests/sign002.py',
  'tests/skip-remove-with-glob-chars.py',
  'tests/smoke001.py',
  'tests/smoke002.py',
  'tests/smoke003.py',
  'tests/smoke004.py',
  'tests/symlink-replace-with-dir.py',
  'tests/symlink001.py',
  'tests/symlink002.py',
  'tests/symlink010.py',
  'tests/symlink011.py',
  'tests/symlink012.py',
  'tests/symlink020.py',
  'tests/symlink021.py',
  'tests/sync-failover-404-with-body.py',
  'tests/sync-install-assumeinstalled.py',
  'tests/sync-nodepversion01.py',
  'tests/sync-nodepversion02.py',
  'tests/sync-nodepversion03.py',
  'tests/sync-nodepversion04.py',
  'tests/sync-nodepversion05.py',
  'tests/sync-nodepversion06.py',
  'tests/sync-sysupgrade-print-replaced-packages.py',
  'tests/sync-update-assumeinstalled.py',
  'tests/sync-update-package-removing-required-provides.py',
  'tests/sync001.py',
  'tests/sync002.py',
  'tests/sync003.py',
  'tests/sync009.py',
  'tests/sync010.py',
  'tests/sync011.py',
  'tests/sync012.py',
  'tests/sync020.py',
  'tests/sync021.py',
  'tests/sync022.py',
  'tests/sync023.py',
  'tests/sync024.py',
  'tests/sync030.py',
  'tests/sync031.py',
  'tests/sync040.py',
  'tests/sync041.py',
  'tests/sync042.py',
  'tests/sync043.py',
  'tests/sync044.py',
  'tests/sync045.py',
  'tests/sync046.py',
  'tests/sync050.py',
  'tests/sync051.py',
  'tests/sync052.py',
  'tests/sync100.py',
  'tests/sync1000.py',
  'tests/sync1003.py',
  'tests/sync1004.py',
  'tests/sync1008.py',
  'tests/sync101.py',
  'tests/sync102.py',
  'tests/sync103.py',
  'tests/sync104.py',
  'tests/sync110.py',
  'tests/sync1100.py',
  'tests/sync1101.py',
  'tests/sync1102.py',
  'tests/sync1103.py',
  'tests/sync1104.py',
  'tests/sync1105.py',
  'tests/sync120.py',
  'tests/sync130.py',
  'tests/sync131.py',
  'tests/sync132.py',
  'tests/sync133.py',
  'tests/sync134.py',
  'tests/sync135.py',
  'tests/sync136.py',
  'tests/sync137.py',
  'tests/sync138.py',
  'tests/sync139.py',
  'tests/sync140.py',
  'tests/sync141.py',
  'tests/sync150.py',
  'tests/sync200.py',
  'tests/sync300.py',
  'tests/sync306.py',
  'tests/sync400.py',
  'tests/sync401.py',
  'tests/sync402.py',
  'tests/sync403.py',
  'tests/sync404.py',
  'tests/sync405.py',
  'tests/sync406.py',
  'tests/sync407.py',
  'tests/sync500.py',
  'tests/sync501.py',
  'tests/sync502.py',
  'tests/sync503.py',
  'tests/sync600.py',
  'tests/sync700.py',
  'tests/sync701.py',
  'tests/sync702.py',
  'tests/sync890.py',
  'tests/sync891.py',
  'tests/sync892.py',
  'tests/sync893.py',
  'tests/sync895.py',
  'tests/sync896.py',
  'tests/sync897.py',
  'tests/sync898.py',
  'tests/sync899.py',
  'tests/sync900.py',
  'tests/sync901.py',
  'tests/sync990.py',
  'tests/sync992.py',
  'tests/sync993.py',
  'tests/sync999.py',
  'tests/trans001.py',
  'tests/type001.py',
  'tests/unresolvable001.py',
  'tests/upgrade001.py',
  'tests/upgrade002.py',
  'tests/upgrade003.py',
  'tests/upgrade004.py',
  'tests/upgrade005.py',
  'tests/upgrade006.py',
  'tests/upgrade010.py',
  'tests/upgrade011.py',
  'tests/upgrade013.py',
  'tests/upgrade020.py',
  'tests/upgrade021.py',
  'tests/upgrade022.py',
  'tests/upgrade023.py',
  'tests/upgrade024.py',
  'tests/upgrade025.py',
  'tests/upgrade026.py',
  'tests/upgrade027.py',
  'tests/upgrade028.py',
  'tests/upgrade029.py',
  'tests/upgrade030.py',
  'tests/upgrade031.py',
  'tests/upgrade032.py',
  'tests/upgrade040.py',
  'tests/upgrade041.py',
  'tests/upgrade042.py',
  'tests/upgrade043.py',
  'tests/upgrade045.py',
  'tests/upgrade050.py',
  'tests/upgrade051.py',
  'tests/upgrade052.py',
  'tests/upgrade053.py',
  'tests/upgrade054.py',
  'tests/upgrade055.py',
  'tests/upgrade056.py',
  'tests/upgrade057.py',
  'tests/upgrade058.py',
  'tests/upgrade059.py',
  'tests/upgrade060.py',
  'tests/upgrade061.py',
  'tests/upgrade070.py',
  'tests/upgrade071.py',
  'tests/upgrade072.py',
  'tests/upgrade073.py',
  'tests/upgrade074.py',
  'tests/upgrade075.py',
  'tests/upgrade076.py',
  'tests/upgrade077.py',
  'tests/upgrade078.py',
  'tests/upgrade080.py',
  'tests/upgrade081.py',
  'tests/upgrade082.py',
  'tests/upgrade083.py',
  'tests/upgrade084.py',
  'tests/upgrade090.py',
  'tests/upgrade100.py',
  'tests/xfercommand001.py',
  'tests/upgrade-download-404.py',
  'tests/upgrade-download-pkg-and-sig-with-filename.py',
  'tests/upgrade-download-with-xfercommand.py',
]

xfail_tests = {
  'tests/deprange001.py': true,
  # expect failure on 32 bit machines
  'tests/query006.py': cc.sizeof('ssize_t') < 8,
  'tests/replace110.py': true,
  'tests/sync-update-package-removing-required-provides.py': true,
  'tests/sync403.py': true,
  'tests/sync406.py': true,
  'tests/upgrade078.py': true,
}

foreach input : pacman_tests
  test_name = input.split('/')[1]
  args = [
    join_paths(meson.current_source_dir(), 'pactest.py'),
    '--scriptlet-shell', get_option('scriptlet-shell'),
    '--bindir', meson.project_build_root(),
    '--ldconfig', LDCONFIG,
    '--verbose',
    join_paths(meson.current_source_dir(), input)
  ]
  if not conf.get('HAVE_LIBCURL')
    args += '--without-curl'
  endif
  if not conf.get('HAVE_LIBGPGME')
    args += '--without-gpg'
  endif

  test(
    test_name,
    PYTHON,
    protocol : 'tap',
    env : ['RUNNING_UNDER_MESON=1'],
    args : args,
    timeout : 120,
    should_fail : xfail_tests.get(input, false),
    depends : [pacman_bin])
endforeach
